home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / include / gsl / gsl_qrng.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-20  |  2.7 KB  |  122 lines

  1. /* Author: G. Jungman
  2.  */
  3. #ifndef __GSL_QRNG_H__
  4. #define __GSL_QRNG_H__
  5.  
  6. #include <stdlib.h>
  7. #include <gsl/gsl_errno.h>
  8.  
  9. #undef __BEGIN_DECLS
  10. #undef __END_DECLS
  11. #ifdef __cplusplus
  12. # define __BEGIN_DECLS extern "C" {
  13. # define __END_DECLS }
  14. #else
  15. # define __BEGIN_DECLS /* empty */
  16. # define __END_DECLS /* empty */
  17. #endif
  18.  
  19. __BEGIN_DECLS
  20.  
  21.  
  22. /* Once again, more inane C-style OOP... kill me now. */
  23.  
  24. /* Structure describing a type of generator.
  25.  */
  26. typedef struct
  27. {
  28.   const char * name;
  29.   unsigned int max_dimension;
  30.   size_t (*state_size) (unsigned int dimension);
  31.   int (*init_state) (void * state, unsigned int dimension);
  32.   int (*get) (void * state, unsigned int dimension, double x[]);
  33. }
  34. gsl_qrng_type;
  35.  
  36. /* Structure describing a generator instance of a
  37.  * specified type, with generator-specific state info
  38.  * and dimension-specific info.
  39.  */
  40. typedef struct
  41. {
  42.   const gsl_qrng_type * type;
  43.   unsigned int dimension;
  44.   size_t state_size;
  45.   void * state;
  46. }
  47. gsl_qrng;
  48.  
  49.  
  50. /* Supported generator types.
  51.  */
  52. #ifdef GSL_EXPORTS
  53. __declspec(dllexport) const gsl_qrng_type * gsl_qrng_niederreiter_2;
  54. #elif defined(GSL_IMPORTS)
  55. __declspec(dllimport) const gsl_qrng_type * gsl_qrng_niederreiter_2;
  56. #else
  57. extern const gsl_qrng_type * gsl_qrng_niederreiter_2;
  58. #endif
  59. #ifdef GSL_EXPORTS
  60. __declspec(dllexport) const gsl_qrng_type * gsl_qrng_sobol;
  61. #elif defined(GSL_IMPORTS)
  62. __declspec(dllimport) const gsl_qrng_type * gsl_qrng_sobol;
  63. #else
  64. extern const gsl_qrng_type * gsl_qrng_sobol;
  65. #endif
  66.  
  67.  
  68. /* Allocate and initialize a generator
  69.  * of the specified type, in the given
  70.  * space dimension.
  71.  */
  72. gsl_qrng * gsl_qrng_alloc (const gsl_qrng_type * T, unsigned int dimension);
  73.  
  74.  
  75. /* Copy a generator. */
  76. int gsl_qrng_memcpy (gsl_qrng * dest, const gsl_qrng * src);
  77.  
  78.  
  79. /* Clone a generator. */
  80. gsl_qrng * gsl_qrng_clone (const gsl_qrng * r);
  81.  
  82.  
  83. /* Free a generator. */
  84. void gsl_qrng_free (gsl_qrng * r);
  85.  
  86.  
  87. /* Intialize a generator. */
  88. void gsl_qrng_init (const gsl_qrng * r);
  89.  
  90.  
  91. /* Get the standardized name of the generator. */
  92. const char * gsl_qrng_name (const gsl_qrng * r);
  93.  
  94.  
  95. /* ISN'T THIS CONFUSING FOR PEOPLE?
  96.   WHAT IF SOMEBODY TRIES TO COPY WITH THIS ???
  97.   */
  98. size_t gsl_qrng_size (const gsl_qrng * r);
  99.  
  100.  
  101. void * gsl_qrng_state (const gsl_qrng * r);
  102.  
  103.  
  104. /* Retrieve next vector in sequence. */
  105. int gsl_qrng_get (const gsl_qrng * r, double x[]);
  106.  
  107.  
  108. #ifdef HAVE_INLINE
  109. extern inline int gsl_qrng_get (const gsl_qrng * r, double x[]);
  110. extern inline int gsl_qrng_get (const gsl_qrng * r, double x[])
  111. {
  112.   return (r->type->get) (r->state, r->dimension, x);
  113. }
  114.  
  115. #endif /* HAVE_INLINE */
  116.  
  117.  
  118. __END_DECLS
  119.  
  120.  
  121. #endif /* !__GSL_QRNG_H__ */
  122.